﻿<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeBehind="AddLocalColorNews.aspx.cs"
    Inherits="NJL.WebManage.LocalColor.AddLocalColorNews" %>

<%@ Import Namespace="Royalsoft.Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
        <style type="text/css">
        #enlarge_images
        {
            position: absolute;
            display: none;
            z-index: 2;
            border: 5px solid #f4f4f4;
        }
        .onshow
        {
            background: #d6e6f5;
        }
    </style>
    <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
    <script type="text/javascript">
        function check() {
            var regInt = /^\d+/; //整数
            var txtSort = document.getElementById("<%=txtSort.ClientID %>").value;
            if (regInt.exec(txtSort) == null) {
                alert("排序只能输入整数");
                return false;
            }
            var txtAttractionsTitle = document.getElementById("<%=txtTitle.ClientID %>").value;
            if (txtAttractionsTitle == "") {
                alert("请输入标题");
                return false;
            }
            var txtSubtitle = document.getElementById("<%=txtSubtitle.ClientID %>").value;
            if (txtSubtitle.length > 500) {
                alert("输入字符数不能超过500个");
                return false;
            }

            //页面描述
            var txtDescription = document.getElementById("<%=txtSeoDescription.ClientID %>").value;
            if (txtDescription.length > 100) {
                alert("页面描述内容数超过100个字符请重新输入");
                return false;
            }

        }
        function textboxSelect() {
            var checkbox = document.getElementsByName("cbxSingle");
            for (var i = 0; i < checkbox.length; i++) {
                checkbox[i].checked = !checkbox[i].checked;
            }
        }
        function checkCheckboxState() {
            var checkbox = document.getElementsByName("cbxSingle");
            var hiddenId = "";
            var count = 0;
            for (var i = 0; i < checkbox.length; i++) {
                if (checkbox[i].checked == true) {
                    hiddenId += checkbox[i].value + ",";
                    count++;
                }
            }
            if (count == 0) {
                alert('请选择您要删除的记录')
                return false;
            }
            else {
                if (window.confirm("您确定要删除该记录？")) {
                    hiddenId = hiddenId.substring(0, hiddenId.length - 1);
                    document.getElementById("<%=HSelectId.ClientID %>").value = hiddenId;
                }
                else {
                    return false;
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="gray_bd">
        <div class="table_title">
            地方特色管理-添加地方特色新闻</div>
        <div class="pad5px">
            <table align="center" cellspacing="0" style="width: 100%">
                <tr>
                    <td style="width: 65px">
                        排序：
                    </td>
                    <td>
                        <asp:TextBox ID="txtSort" runat="server" MaxLength="8" Width="50px">0</asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        标题：
                    </td>
                    <td>
                        <asp:TextBox ID="txtTitle" runat="server" Width="400px" MaxLength="50"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        副标题：
                    </td>
                    <td>
                        <asp:TextBox ID="txtSubtitle" runat="server" Width="400px" TextMode="MultiLine" Height="80"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        标签：
                    </td>
                    <td>
                        <asp:TextBox ID="txtTag" runat="server" Width="400px" MaxLength="100"></asp:TextBox>
                        多个标签请用逗号隔开
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        图片：&nbsp;
                    </td>
                    <td>
                        <asp:FileUpload ID="FileUpload1" runat="server" />
                        &nbsp;&nbsp;<asp:Button ID="Button1" runat="server" Text="上传" OnClick="btnUpload_Click"
                            Visible="false" />上传图片的尺寸要根据前台使用的图片上传
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        内容：
                    </td>
                    <td>
                        <asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" Height="61px" Width="100%"></asp:TextBox>
                        <script type="text/javascript">
                            CKEDITOR.replace('<%=txtContent.ClientID%>',
                            {
                                filebrowserBrowseUrl: '/ckfinder/ckfinder.html', //启用浏览功能
                                filebrowserImageBrowseUrl: '/ckfinder/ckfinder.html?Type=Images',
                                filebrowserFlashBrowseUrl: '/ckfinder/ckfinder.html?Type=Flash',
                                filebrowserUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files',
                                filebrowserImageUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images',
                                filebrowserFlashUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash'
                            }
                            );
                        </script>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        页面标题：
                    </td>
                    <td>
                        <asp:TextBox ID="txtSeoTitle" runat="server" Width="100%" MaxLength="100"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        页面关键字：
                    </td>
                    <td>
                        <asp:TextBox ID="txtSeoKeyworkds" runat="server" Width="100%" MaxLength="100"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        页面描述：
                    </td>
                    <td>
                        <asp:TextBox ID="txtSeoDescription" runat="server" Height="51px" TextMode="MultiLine"
                            Width="100%"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Style="height: 21px"
                            Text="提交" Width="40px" OnClientClick="return check()" />
                        &nbsp;<input id="Reset1" type="reset" value="返回" runat="server" />
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
            <div class="border_b_dotted">
                <table class="tableliststyle" cellspacing="0" rules="all" border="1" id="demo">
                    <tr class="gridheader" onmouseover="this.className='onshow'" onmouseout="this.className=''" class="">
                        <th style="width: 40px;">
                            <input id="cbxAll" type="checkbox" onclick="textboxSelect()" />
                        </th>
                        <th>
                            序号
                        </th>
                        <th>
                            标题
                        </th>
                        <th>
                            图片
                        </th>
                        <th>
                            发布时间
                        </th>
                        <th>
                            排序
                        </th>
                        <th style="width: 40px;">
                            编辑
                        </th>
                        <th style="width: 40px;">
                            删除
                        </th>
                    </tr>
                    <asp:Repeater ID="rptUserList" runat="server" OnItemCommand="rptUserList_ItemCommand"
                        OnItemDataBound="rptUserList_ItemDataBound">
                        <ItemTemplate>
                            <tr>
                                <td align="center">
                                    <input id="<%#Eval("ID") %>" type="checkbox" value="<%#Eval("ID") %>" name="cbxSingle" />
                                </td>
                                <td align="center">
                                    <asp:Literal ID="litNum" runat="server"></asp:Literal>
                                </td>
                                <td align="center">
                                    <%#PageValidate.SqlText(Eval("NEWS_TITLE").ToString(),10)%>
                                </td>
                                <td>
                                    <img src="<%#GetImageUrl(Eval("IMAGE_CODE").ToString())%>" alt="<%#Eval("NEWS_TITLE") %>" title="<%#Eval("NEWS_TITLE") %>" width="80" height="50" style="display:<%#Eval("IMAGE_CODE").ToString()==""?"none":"block"%>" />
                                </td>
                                <td align="center">
                                    <%#Eval("CREATE_DATE_TIME", "{0:yyyy-MM-dd HH:mm:ss}")%>
                                </td>
                                <td align="center">
                                    <%#Eval("SORT")%>
                                </td>
                                <td align="center">
                                    <asp:LinkButton ID="lbntEdit" runat="server" CommandName="Edit" CommandArgument='<%#Eval("ID") %>'>编辑</asp:LinkButton>
                                </td>
                                <td align="center">
                                    <asp:LinkButton ID="lbtnDel" runat="server" CommandName="Del" CommandArgument='<%#Eval("ID") %>'
                                        OnClientClick="return confirm('您确定要删除该信息吗？')">删除</asp:LinkButton>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
                <div style="text-align: left; margin-top: 5px;">
                    <asp:Button ID="btnDel" runat="server" Text="删除" OnClientClick="return checkCheckboxState()"
                        OnClick="btnDel_Click1" />
                </div>
                <asp:HiddenField ID="HSelectId" runat="server" />
            </div>
        </div>
    </div>
    </form>
        <div id="enlarge_images">
    </div>
    <script type="text/javascript">
        var demo = document.getElementById("demo");
        var gg = demo.getElementsByTagName("img");
        var ei = document.getElementById("enlarge_images");
        for (i = 0; i < gg.length; i++) {
            var ts = gg[i];
            ts.onmousemove = function (event) {
                event = event || window.event;
                ei.style.display = "block";
                ei.innerHTML = '<img src="' + this.src + '" />';
                ei.style.top = document.body.scrollTop + event.clientY + 10 + "px";
                ei.style.left = document.body.scrollLeft + event.clientX + 10 + "px";
            }
            ts.onmouseout = function () {
                ei.innerHTML = "";
                ei.style.display = "none";
            }
            ts.onclick = function () {
                window.open(this.src);
            }
        }
    </script>
</body>
</html>
